class Solution:
    def subsets(self, nums):
        length=len(nums)
        subsets=[[]]
        def findsubset(prefix,offset):
            subsets.append(prefix[:])
            if offset==length-1:
                return 
            for i in range(offset+1,length):
                prefix.append(nums[i])
                findsubset(prefix,i)
                prefix.pop(-1)
        for i in range(length):
            findsubset([nums[i]],i)
        return subsets
    
s=Solution()
print(s.subsets([1,2,3,5,4]))